using QAssetBundle;
using UnityEngine;
using QFramework;
using QFramework.Example;

namespace XCZProject
{
	public partial class TreasureChest : GameplayObject
	{
		void Start()
		{
			// Code Here
		}		
		
		private void OnTriggerEnter2D(Collider2D collider2D)
		{
			// 当碰撞的物体拥有“拾取范围”脚本时，则证明经验球碰到了玩家，增加经验并且删除该物体
			if (collider2D.GetComponent<CollectableArea>())
			{
				UIGamePanel.OpenTreasurePanelEvent.Trigger();
				AudioKit.PlaySound(Sfx.TREASUER_CHEST);
				this.DestroyGameObjGracefully();
			}
		}
		protected override Collider2D Collider2D => SelfCollider2D;
	}
}
